<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>个人资料</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=yes" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/join.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>

</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=mine&prefix=3g_mine&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num">WMP11200</span>
       </div>
    </div>
    <div class="blank"></div>
    <div class="content m-top">
        <div class="content-1">
            <div class="content-1-2"><a href="javascript:void(0)"><span>农商易头像</span><img src="${empty user.thumbnail ? '../../images/tou.png' : user.thumbnail}" id="img-2" class="img-2 right"></a></div>
            <div class="content-1-1"><a href="javascript:void(0)"><span>农商易号</span><span class="span-1 right" id="atUserId">${user.atUserId}</span></a> </div>
            <div class="content-1-1"><a href="javascript:void(0)" id="realName"><span>真实姓名</span><img src="<%=basepath%>images/b43.png"><span class="span-1" id="realName-1">${user.realName}</span></a> </div>
            <div class="content-1-1"><a href="javascript:void(0)" id="sex"><span>性别</span><img src="<%=basepath%>images/b43.png"><span class="span-1" id="sex-1">${empty user.sex ? '' : user.sex eq 1 ? '男' : '女'}</span></a> </div>
            <div class="content-1-1 border"><a href="javascript:void(0)" id="nickname"><span>昵称</span><img src="<%=basepath%>images/b43.png"><span class="span-1" id="nickname-1">${user.nickName}</span></a> </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    /*错误提示*/
    $(function(){
        var error = "${requestScope.returnMsg}";
        if(error != "" && error != "成功!"){
            layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
        }
    });
    /*真实姓名*/
    $(function(){
    	$("#realName").click(function(){
    		layer.prompt({
    			title:'真实姓名',
    			type:0
    		},function(realName){
    			if(realName !=""){
    				$.ajax({
                        type:"post",
                        url:"/wape-web/api/core/centerService",
                        data:{
                            serviceCode:"5003U02",
                            realName:realName
                        },
                        success:function(data){
                            var realName1 = eval("("+data+")");
                            if(realName1.returnCode == "200"){
                            	$("#realName-1").text(realName);
                            }
                            else if(realName1.returnCode == "W2001"){
                                layer.msg("修改失败",{shadeClose:true,shade:0.1,time:2000});
                            }
                            else{
                                layer.msg("修改失败!",{shadeClose:true,shade:0.1,time:2000});
                            }
                        }
                    });
    			}
    			layer.closeAll();
    		});
    	});
    });
    /*性别 */
    $(function(){
    	$("#sex").click(function(){
    		layer.open({
    			type: 1,
    			  title: false,
    			  area: ['250px', '101px'],
    			  shade: 0.1,
    			  closeBtn: 0,
    			  shadeClose: true,
    			  content: '<div style="width:100%;height:100px;"><a href="javascript:void(0)" id="a-1" style="width:100%;height:50px;display:inline-block;text-align:center;color:#333;line-height:50px;border-bottom:1px solid #ccc;font-size:16px;">男</a><a href="javascript:void(0)" id="a-2" style="width:100%;height:50px;display:inline-block;text-align:center;color:#333;line-height:50px;font-size:16px;">女</a></div>'
    		});
    		/*男*/
    		$("#a-1").click(function(){
    	        
    			$.ajax({
                    type:"post",
                    url:"/wape-web/api/core/centerService",
                    data:{
                        serviceCode:"5003U02",
                        sex:"1"
                    },
                    success:function(data){
                        var nan = eval("("+data+")");
                        if(nan.returnCode == "200"){
                        	$("#sex-1").text("男");
                        }
                        else if(nan.returnCode == "W2001"){
                            layer.msg("修改失败",{shadeClose:true,shade:0.1,time:2000});
                        }
                        else{
                            layer.msg("修改失败!",{shadeClose:true,shade:0.1,time:2000});
                        }
                    }
                });
				layer.closeAll();
			});
    		/*女*/
			$("#a-2").click(function(){
				$.ajax({
                    type:"post",
                    url:"/wape-web/api/core/centerService",
                    data:{
                        serviceCode:"5003U02",
                        sex:"0"
                    },
                    success:function(data){
                        var nv = eval("("+data+")");
                        if(nv.returnCode == "200"){
                        	$("#sex-1").text("女");
                        }
                        else if(nv.returnCode == "W2001"){
                            layer.msg("修改失败",{shadeClose:true,shade:0.1,time:2000});
                        }
                        else{
                            layer.msg("修改失败!",{shadeClose:true,shade:0.1,time:2000});
                        }
                    }
                });
				layer.closeAll();
			});
    	});
    });
    /*昵称*/
    $(function(){
    	$("#nickname").click(function(){
    		layer.prompt({
    			title:'昵称',
    			type:0
    		},function(nick){
    			if(nick !=""){
    				$.ajax({
                        type:"post",
                        url:"/wape-web/api/core/centerService",
                        data:{
                            serviceCode:"5003U02",
                            nickName:nick
                        },
                        success:function(data){
                            var nick1 = eval("("+data+")");
                            if(nick1.returnCode == "200"){
                            	$("#nickname-1").text(nick);
                            }
                            else if(nick1.returnCode == "W2001"){
                                layer.msg("修改失败",{shadeClose:true,shade:0.1,time:2000});
                            }
                            else{
                                layer.msg("修改失败!",{shadeClose:true,shade:0.1,time:2000});
                            }
                        }
                    });
    			}
    			layer.closeAll();
    		});
    	});
    });
    
</script>
</html>
